package com.orhon.smartcampus.modules.base.mm;

import com.orhon.smartcampus.modules.base.entity.Subjects;
import com.orhon.smartcampus.modules.base.gqlModel.GQLSubject;

import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper(
        uses = {
                LangMapper.class ,
                PeriodMapper.class,
                GradeMapper.class
        }
)
public interface SubjectMapper {

    SubjectMapper MAPPER = Mappers.getMapper(SubjectMapper.class);

    @Mapping(source = "id" , target = "id")
    @Mapping(source = "subjectName" , target = "subject_name")//lang
    @Mapping(source = "subjectSlug" , target = "subject_slug")
    @Mapping(source = "subjectNumber" , target = "subject_number")
    @Mapping(source = "subjectOrder" , target = "subject_order")
    @Mapping(source = "mark" , target = "mark")
    @Mapping(source = "type" , target = "type")
    @Mapping(ignore = true, target = "period" )
    @Mapping(ignore = true, target = "grade" )
    @Mapping(ignore = true, source = "teacher" , target = "teacher")
    GQLSubject toSubject(Subjects entity);
    
    @InheritConfiguration(name = "toSubject")
    List<GQLSubject> toSubjectList(List<Subjects> entities);


}
